//
//  CardbagModel.swift
//  CardBag
//
//  Created by hl on 2019/5/16.
//  Copyright © 2019 hlznj. All rights reserved.
//

import UIKit
import RealmSwift

class CardbagModel: Object {

    @objc dynamic var cardbagName = ""          //卡名
    @objc dynamic var cardbagType = ""          //卡类型       Qr Bar unknown

    @objc dynamic var cardbagImageURL = ""      //默认图 (根据品牌显示)
    @objc dynamic var cardbagCode = ""          //条形码Code or 二维码Code

    @objc dynamic var cardbagImageFrontURL = "" //会员卡正面图片地址
    @objc dynamic var cardbagImageBackURL = ""  //会员卡背面图片地址

    //反向表示该对象的拥有者
    let owners = LinkingObjects(fromType: CardbagGroupModel.self, property: "cardbags")

}

class CardbagGroupModel: Object {

    @objc dynamic var groupName = ""
    @objc dynamic var id = 0

    //设置主键
    override static func primaryKey() -> String? {
        return "id"
    }

    var cardbags = List<CardbagModel>()

}
